import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
const store = new Vuex.Store({
  state: {
    successLogin: 0, //默认为0没有登录
    id: "", //登陆后给到返回一个id ，通过id去查询用户的数据
    zhiwei: false,
    citybox: false,
    citys: false,
    login: false,
    judge: false,
    arr: {
      names: "", //姓名
      gender: "男", //性别
      marry: "", //婚姻状况
      birth: "", //出生年月
      student: "", //第一学历
      allday: "", //是否全日制
      politicsStatus: "", //政治面貌
      training: "", //是否规培
      practicing: "", //执业资格
      support: "", //职称
      major: "", //专业
      email: "", //邮箱
      annualincome: "", //年收入
      masterpiece: "", //经验
    },
    objs: {
      cityss: "", //意向地区
      zhiwei: "", //意向职位
      zhuangtai: "", //在职状态
      leixin: "", //在职类型
      gotime: "", //到岗时间
      wantmonthmoney: "", //期望月薪
      wantyearmoney: "", //期望年薪
      nowmonthmoney: "", //目前月薪
      nowyearmoney: "", //目前年薪
    },
    imgs: [
      "img8.jpg",

      "img9.jpg",

      "img10.jpg",

      "img11.jpg",

      "img12.jpg",

      "img13.jpg",

      "img14.jpg",

      "img15.jpg",

      "img16.jpg",

      "img17.jpg",
    ],
  },
  getters: {},
  mutations: {
      cencel(state, payload){
            state.successLogin=payload
            state.id=""
    for(let key in state.arr){obj[key]=''}
    for(let key in state.objs){obj[key]=''}
      },
     gologin(state, payload) {
      if (payload) {
        state.id = payload;
        state.successLogin = 1;
      }
    },
    setData(state, param) {
        state.objs = Object.assign({}, state.objs, param);
        console.log(state.objs);
    },
    setArr(state, param) {
      state.arr = Object.assign({}, state.arr, param);
      console.log(state.arr);
    },
    fn(state) {
      state.login = !state.login;
    },
    fn1(state) {
      state.judge = !state.judge;
    },
    fn2(state) {
      state.citys = !state.citys;
    },
    fn3(state) {
      state.citybox = !state.citybox;
    },
    fn4(state, payload) {
      state.objs.cityss = payload;
      console.log("??", state.objs.cityss);
    },
    fn5(state) {
      state.zhiwei = !state.zhiwei;
    },
    fn6(state, payload) {
      state.objs.zhiwei = payload;
    },
  },
  actions: {
    // async getuserdata(ctx, payload) {
    //     debugger;
    //   if (payload != "") {
    //       let res = await this.$http.get("/loginapi/getuserdata?id=" + payload) ;
    //     return res;
    //   }
    // },
  },
});

export default store;
